package com.dataaccess;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {
	private static final String DB_NAME = "DB_USER";
	private static final int DB_VER = 1;
	private static final String TB_REMIND = "NHAC_NHO";
	private static final String C_ID = "MA";
	private static final String C_ICO = "BIEU_TUONG";
	private static final String C_TITLE = "TIEU_DE";
	private static final String C_CONTENT = "NOI_DUNG";
	private static final String C_DATETIME = "NGAY_GIO";
	private static final String C_ALARM = "KIEU_TB";
	private static final String C_TONE = "AM_TB";
	
	public DatabaseHelper(Context context) {
		super(context, DB_NAME, null, DB_VER);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		String query = "CREATE TABLE " + TB_REMIND + " (" + C_ID
				+ " INTEGER PRIMARY KEY AUTOINCREMENT, " + C_ICO
				+ " TEXT NOT NULL, " + C_TITLE + " TEXT, " + C_CONTENT
				+ " TEXT, " + C_DATETIME + " INTEGER NOT NULL, " + C_ALARM
				+ " TEXT NOT NULL, " + C_TONE + " TEXT);";
		db.execSQL(query);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + TB_REMIND);
		onCreate(db);
	}
}
